import React, { PureComponent } from 'react';
import { connect } from 'dva';
import { routerRedux, Link } from 'dva/router';
import { Form, Input, Select, Button, Card, message, Radio, Cascader, Upload, Icon, Modal } from 'antd';
import DescriptionList from '../../components/DescriptionList';
import Img from 'react-image';
import PageHeaderLayout from '../../layouts/PageHeaderLayout';
import moment from 'moment';
import { urlParams }  from '../../utils/utils';
import globalConstant from '../../utils/globalConstant';
const { Description } = DescriptionList;

const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const TextArea = Input.TextArea;

@connect(({ immanage, loading }) => ({
  immanage,
  loading: loading.models.immanage,
}))
@Form.create()
export default class WorkOrdePass extends PureComponent {
  state = {
    uploadFileLength: [],
    previewVisible: false,
    previewImage: '',
    time:'2017-12-23 17：23：25'
  }
  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'immanage/getWorkOrderDetail',
      payload: {
        id: urlParams('id',window.location.href),
      },
    });
  }
  ContinueReview =() => {
    this.props.dispatch(routerRedux.push('/account/workorde'));
  }
  render() {
    const { loading } = this.props;
    const { workOrderInfo } = this.props.immanage;
    return (
      <PageHeaderLayout title="用戶管理">
        <Card title="工單完结" >
          <DescriptionList size="large" title="" style={{ textAlign:'center',justifyContent: 'center',}} col={1}>
            <Img style={{ width: 170, height: 90,marginBottom: 42 }} src="./img/icon-3.png" />
            <div style={{ marginBottom: 32,}}>师傅完成工单</div>
            <div style={{ marginBottom: 42}}>安装工单已经发送给师傅，并推送给用户。</div>
          </DescriptionList>
          <Card title="" loading={loading} extra = {`报装时间：   ${moment(workOrderInfo.createTime).format(globalConstant.time)}`}>
            <DescriptionList size="large"  title=""  col={2}>
              <Description term="报装套餐">{workOrderInfo.userContactName}</Description>
              <Description term="安装地址">{workOrderInfo.addrDetail}</Description>
              <Description term="联 系 人">{workOrderInfo.userContactName}</Description>
              <Description term="联系电话">{workOrderInfo.userContactPhone}</Description>
              <Description term="宽带信息">{workOrderInfo.netAccountInfo}</Description>
              <Description term="安装师傅">{workOrderInfo.workerName}元</Description>
            </DescriptionList>
            <Description term="">
              <Button style={{ width: 130,marginTop: 70 }} type="primary" onClick={this.ContinueReview}>
                继续审核订单
              </Button>
            </Description>
          </Card>
        </Card>
      </PageHeaderLayout>
    );
  }
}
